package com.hankol.newretail.adapter.order

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.hankol.newretail.fragment.MyOrderFragment

/**
 * @author: 关忆北、
 * @date: 2022/8/8
 * @Des：
 */
class MyOrderTabVp(fm: FragmentManager) : FragmentPagerAdapter(fm) {
    private val fragmentList: ArrayList<MyOrderFragment> = arrayListOf()
    private var titleList= mutableListOf<String>()
    fun setTitleList(titleList:MutableList<String>){
        this.titleList=titleList
    }
    fun setDatas(fragmentList: ArrayList<MyOrderFragment>) {
        this.fragmentList.clear()
        this.fragmentList.addAll(fragmentList)
        notifyDataSetChanged()
    }

    override fun getCount(): Int {
        return fragmentList.size
    }

    override fun getItem(position: Int): Fragment {
        return fragmentList[position]
    }

    override fun getPageTitle(position: Int): CharSequence? {
        return titleList[position]
    }
}